package com.feign.config;

import com.feign.interceptor.FeignTokenInteceptor;
import feign.Logger;
import feign.RequestInterceptor;
import org.springframework.context.annotation.Bean;

/**
 * @作者: 林江
 * @创建时间: 2023/10/27
 * @功能:
 */
public class FeignConfig {

    /**
     * 配置日志级别
     *
     * @return
     */
    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }

    @Bean
    public RequestInterceptor requestInterceptor() {
        return new FeignTokenInteceptor();
    }

    /**
     * 自定义编码器
     */
//    @Bean
//    public Encoder encoder() {
//        return new Encoder() {
//            @Override
//            public void encode(Object object, Type bodyType, RequestTemplate template) throws EncodeException {
//                System.out.println("自定义编码器。。。。。。。。。。。。。。");
////                template.header("Content-Type","application/json");
////                template.body(JSON.toJSONString(object));
////                template.body(JSON.toJSONBytes(object), Charset.defaultCharset());
//            }
//        };
//    }
}
